package com.yunyi.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.yunyi.contants.AudioConstants;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class InitialRequest {

    @JSONField(name = "audio_fs")
    private Integer audioFs;

    @JSONField(name = "chunk_interval")
    private Integer chunkInterval;

    private String mode;

    @JSONField(name = "wav_name")
    private String wavName;

    @JSONField(name = "wav_format")
    private String wavFormat;

    @JSONField(name = "is_speaking")
    private Boolean speaking;

    /**
     * 需要map转json后的字符串
     * key为关键词,value为权重
     */
    @JSONField(name = "hotwords")
    private String hotWords;

    @JSONField(name = "chunk_size")
    private List<Integer> chunkSize;

    private Boolean itn;

    public InitialRequest() {
        this.mode = "offline";
        this.audioFs = AudioConstants.AUDIO_FS;
        this.speaking = Boolean.TRUE;
        this.itn = Boolean.FALSE;
        this.chunkSize = new ArrayList<>();
        this.chunkSize.add(5);
        this.chunkSize.add(10);
        this.chunkSize.add(5);
        this.chunkInterval = 10;

    }

    public InitialRequest(String mode, String wavName, String wavFormat,
                          boolean isSpeaking, String hotWords, boolean itn) {
        this.mode = mode;
        this.wavName = wavName;
        this.wavFormat = wavFormat;
        this.speaking = isSpeaking;
        this.hotWords = hotWords;
        this.itn = itn;
    }


}
